import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)

// 引入饿了么预设语言包
import elementZH from 'element-ui/lib/locale/lang/zh-CN'
import elementEN from 'element-ui/lib/locale/lang/en'

// 引入自定义菜单的语言包
import customZH from './zh'
import customEN from './en'
// 引入cokkie
import Cookies from 'js-cookie'

export default new VueI18n({

  // 设置当前语音
  // locale: 'zh',
  locale: Cookies.get('language') || 'zh',
  // 设置字典
  messages: {
    zh: {
      hi: '你好啊',
      gd: '祝你开心每一天',
      changeSuccess: '切换语言成功',
      ...elementZH,
      ...customZH
    },
    en: {
      hi: 'hello',
      gd: 'good luck',
      changeSuccess: 'Change language successfully',
      ...elementEN,
      ...customEN
    }
  }

})
